{include file="public/header"  title="修改密码"}
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong><span class="icon-key"></span> 修改会员密码</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="">
      <div class="form-group">
        <div class="label">
          <label for="sitename">管理员帐号：</label>
        </div>
        <div class="field">
          <label style="line-height:33px;">
           {:session('userInfo')['name']}
          </label>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label for="sitename">新密码：</label>
        </div>
        <div class="field">
          <input type="password" class="input w50" name="newpass" size="50" placeholder="请输入新密码" data-validate="required:请输入新密码,length#>=5:新密码不能小于5位" />         
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label for="sitename">邮箱：</label>
        </div>
        <div class="field">
          <input type="email" class="input w50" readonly name="email" size="50" id="email" placeholder="请输入邮箱" data-validate="required:请输入邮箱" value="{:session('userInfo')['email']}" />
          <input type="button" style="color: white;background-color: rgb(0, 170, 238);outline: none;border: none;height: 42px" id="emailCode" value="发送邮箱验证码">
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label for="sitename">邮箱验证码：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50"  name="emailCode" size="50"  placeholder="请输入邮箱验证码" data-validate="required:请输入邮箱验证码"" />
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>   
        </div>
      </div>      
    </form>
  </div>
</div>
</body></html>
<script>
  $('#emailCode').click(function () {
      var email=$('#email').val();
      var num=60;
      $(this).val(num+'s');
      $(this).attr('disabled',true);
      $.ajax({
          async:true,
          url:"{:url('Index/ajaxEmailCode')}",
          data:{email:email},
          dataType:'json',
          type:'post',
          success:function (data) {
              console.log('发送邮箱');
          }
      })
      var timer=setInterval(function () {
          if (num>0){
              --num;
              $('#emailCode').val(num+'s');
          }else {
              $('#emailCode').attr('disabled',false);
              $('#emailCode').val('发送验证码');
              clearInterval(timer);
              num=60;
          }
      },1000)
  })
</script>